package com.ruoyi.system.ali;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONUtil;
import com.ruoyi.common.utils.RequestUtil;
import com.ruoyi.system.dto.ApiNotifyDto;
import lombok.Data;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;

import java.math.BigDecimal;
import java.util.HashMap;

@Data
public class AliPayDto {

    private String orderNo;

    private BigDecimal amount;

    private String notifyUtl="http://api.umashang.top/api/zfb/notify";

    public static void main(String[] args) {

        // HttpUtils.sendSSLPost()
        String url="https://a.sdpay.top/notify/juhepay_merchantOrderNo/notify_res.htm";
        String pa="{\"amount\":\"499.99\",\"merchantId\":424,\"merchantOrderNo\":\"P01202404202144270972248\",\"sign\":\"7B14B88CBADECC76EE79EC5137E146AB\",\"status\":\"success\",\"type\":\"receive\"}";
        ApiNotifyDto json= JSONUtil.toBean(pa, ApiNotifyDto.class);
        String request = RequestUtil.request(url, json, MediaType.APPLICATION_JSON, HttpMethod.POST, null);
        System.out.println(request);
    }
}
